import axios from '../utils/axios'

// ---------------------不需要登录的---------------------
export const getExplore=(page)=>axios.get('/image/getExplore?page='+page);

export const getExploreCount=(page)=>axios.get('/image/getExploreCount');

// ---------------------需要登录的---------------------
export const getImgList=(userId,page,imgNote,isPrivate)=>axios.get('/image',
{
	params:{
		userId:userId,
		page:page,
		imgNote:imgNote,
		isPrivate:isPrivate
	}
})

export const getImgCount=(userId)=>axios.get('/image/getCount?userId='+userId);

export const editImage=(imgId,isPrivate,imgNote)=>axios.put('/image',{imgId:imgId,isPrivate:isPrivate,imgNote:imgNote})

export const deleteImg=(imgId,userId)=>axios.delete('/image',{data:{imgId:imgId,userId:userId}});

export const uploadImg=(userId,imgUrl)=>axios.post('/image/uploadImg',{userId:userId,imgUrl:imgUrl});

export const uploadLinkImg=(imgUrl)=>axios.get('https://api.uomg.com/api/image.360?imgurl='+imgUrl);

// ---------------------管理员---------------------
export const getAllImgList=(page,imgNote,isPrivate)=>axios.get('/admin/image',{
	params:{
		page:page,
		imgNote:imgNote,
		isPrivate:isPrivate
	}
})

export const getAllImgCount=()=>axios.get('/admin/image/count');

export const adminDelete=(imageId)=>axios.delete('/admin/image',{data:{id:imageId}});

export const adminUpdate=(imgId,isPrivate,imgNote)=>axios.put('/admin/image',{imgId:imgId,isPrivate:isPrivate,imgNote:imgNote});

// ---------------------测试---------------------
export const uploadOnline=(files,headers)=>axios.post('https://img.oioweb.cn/api.php',files,headers);

export const uploadTest=(files,headers)=>axios.post('/image/uploadTest',files,{headers:{'Content-Type':'multipart/form-data'}});

export const getTestImg=()=>axios.get('/image/getTestImg');

export const deleteTestImg=(list)=>axios.get('/image/deleteTestImg?list='+list);